<?php
/**
 * Handles Coupons.
 * @copyright 2008 Nicolas Schudel
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
 */

class Coupons {
	private $db;
	private $cf;
	public $coupon;

	function __construct() {
		$this->db = ServiceLocator::getService( 'ConnectionFactory' );
		$this->cf = ServiceLocator::getService('Configuration');
		$this->db->connect($this->cf->get('DB_SERVER'), $this->cf->get('DB_SERVER_USERNAME'), $this->cf->get('DB_SERVER_PASSWORD'), $this->cf->get('DB_DATABASE'), $this->cf->get('DB_USE_PCONNECT'), false);
	}
	
	public function process($coupon_code) {
		if (isset($coupon_code)) {
			$coupon_code_query = "select coupon_code from " . $this->cf->get('TABLE_COUPONS') . " where coupon_id = '" . $coupon_code . "'";
			$coupon_code = $this->db->execute($coupon_code_query);
			echo "COUPON HANDLING NOT YET IMPLEMENTED!!";
		}
		return $coupon_code;
	}
	
}
?>
